<link rel="stylesheet" type="text/css" href="/static/comment/css/bootstrap.css">
<style>
  .commentbox{
    margin: 20px auto;
  }
  .mytextarea {
      width: 100%;
      overflow: auto;
      word-break: break-all;
      height: 100px;
      color: #000;
      font-size: 1em;
      resize: none;
  }
  .comment-list{
    margin: 20px auto;
    clear: both;
    padding-top: 20px;
  }
  .comment-list .comment-info{
    position: relative;
    margin-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid #ccc;
  }
  .comment-list .comment-info header{
    width: 10%;
    position: absolute;
  }
  .comment-list .comment-info header img{
    width: 100%;
    border-radius: 50%;
    padding: 5px;
  }
  .comment-list .comment-info .comment-right{
    padding:5px 0px 5px 11%;
  }
  .comment-list .comment-info .comment-right h3{
    margin: 5px 0px;
  }
  .comment-list .comment-info .comment-right .comment-content-header{
    height: 25px;
  }
  .comment-list .comment-info .comment-right .comment-content-header span,.comment-list .comment-info .comment-right .comment-content-footer span{
    padding-right: 2em;
    color: #aaa;
  }
  .comment-list .comment-info .comment-right .comment-content-header span,.comment-list .comment-info .comment-right .comment-content-footer span.reply-btn,.send,.reply-list-btn{
    cursor: pointer;
  }
  .comment-list .comment-info .comment-right .reply-list {
    border-left: 3px solid #ccc;
    padding-left: 7px;
  }
  .comment-list .comment-info .comment-right .reply-list .reply{
    border-bottom: 1px dashed #ccc;
  }
  .comment-list .comment-info .comment-right .reply-list .reply div span{
    padding-left: 10px;
  }
  .comment-list .comment-info .comment-right .reply-list .reply p span{
    padding-right: 2em;
    color: #aaa;
  }
</style>
  <div class="commentbox">
    <textarea cols="80" rows="50" placeholder="来说几句吧......" class="mytextarea" id="content"></textarea>
    <div class="btn btn-info pull-right" id="comment">评论</div>
  </div>
  <div class="comment-list">
  </div>

<script type="text/javascript" src="/static/comment/js/jquery.min.js"></script>
<script type="text/javascript" src="/static/comment/js/jquery.comment.js" ></script>
<script type="text/javascript" src="/static/comment/js/bootstrap.min.js"></script>
<script type="text/javascript">
  //初始化数据
  $(function(){

    //加载分类数据
 $.ajax({
            url:"/comment/list/json",
            data:{},
            type:"POST",
            dataType:"json",
            timeout:5000,
            success:function(json){
              //读取评论
                $(".comment-list").addCommentList({data:json,add:""});
            },
            error:function(xhr, status){
                alert("请求出错。");
            }
    });





    $("#comment").click(function(){
      content=$("#content").val();
      nickname='匿名';
      var obj = new Object();
      obj.img="/static/comment/images/img.jpg";
      obj.replyName=nickname;
      obj.content=content;
      obj.browse="深圳";
      obj.osname="win10";
      obj.replyBody="";
      $(".comment-list").addCommentList({data:[],add:obj});
      $("#content").val("");
    });
  })
</script>